
#!/bin/sh

while((1))
do
    CGROUP_USAGE_1=$(cat  /sys/fs/cgroup/cpuacct/cpuacct.usage)

    sleep 1

    CGROUP_USAGE_2=$(cat /sys/fs/cgroup/cpuacct/cpuacct.usage)

    CGROUP_USAGE=`expr $CGROUP_USAGE_2 - $CGROUP_USAGE_1`

    CGROUP_RATE=`expr $CGROUP_USAGE/1000000000*100 | bc -l`

    echo $CGROUP_USAGE, $CGROUP_RATE
done


